1. Field of the Invention
The present invention relates to a method for controlling a robot which follows a moving object which is conveyed on a conveyor or the like and which performs a predetermined action on the moving object. The present invention also relates to a robot controller using the method.
2. Description of the Related Art
Hitherto, in conveyor tracking in which such a moving object (hereinafter referred to as a xe2x80x9cworkxe2x80x9d) is followed, an external sensor such as a proximity switch determines as to whether the work has come into a region in which a robot can move, and the robot starts to follow the work at its finger tip (tool) in accordance with a determination signal and performs an action on the work when the hands reach the work. The known conveyor tracking has been applied mainly to welding of automotive bodies disposed on a conveyor. The known system of conveyor tracking has been formed such that the conveyor moves at a low speed and a small number of the works (generally one work) is processed at one time.
Recently, various applications have required conveyor tracking, and a processing of a plurality of the works have been required while they are conveyed on a conveyor at a certain level of speed. However, it has been difficult to realize applications by using a system such as that described above in which a small number of works are processed.
When the positions of the works change, a certain amount of computation in proportion to the number of works is necessary. Therefore, for example, when the robot is positioned so as to be inclined with respect to the conveyor instead of being parallel thereto, the current positions of the works must be computed by performing trigonometric computations based on the angle of inclination of the robot with respect to the amount of movement of the conveyor. Thereby, the amount of the computation becomes significantly increased because it is necessary to compute an x-coordinate value and a y-coordinate value in a robot coordinate system (a rectangular coordinate system (x, y, and z) in which the z-axis is a vertical axis having the origin at a mounting base of the robot). Therefore, there is a problem in that the number of works which can be processed at one time is limited, a high-speed CPU for processing numbers of the works is required, and so on.
In an operation program for the robot to follow the works on a conveyor, a targeted position of the tool of the robot is set in the robot coordinate system. Therefore, it is difficult to designate the position based on the conveyor (for example, to designate a position 5 mm upstream from the center of a work or a position 10 mm upward in the width direction of the conveyor from the center of the work), and therefore, the description of the program becomes complex.
Recently, a system which uses a camera for detecting the works has been known. It is expected that the system can be used when a plurality of the works are scattered on a conveyor because the camera can determine the positions and orientation of the works. However, the problem of the large amount of computation for updating the present positions of the works has not been overcome even in such a system.
In these known systems, the users must program processes for checking whether a work is positioned in an operational range of the robot or out of the operational range. Therefore, a process loop for monitoring whether or not the current position of the work is in the operational range must be described in the user program.
FIG. 20 shows an example of the description of a user program. FIG. 21 is a flowchart corresponding to the user program shown in FIG. 20. The same reference numerals are used for corresponding steps in FIGS. 20 and 21.
In this user program, it is checked by a process loop (DO . . . LOOP) whether or not the work is positioned in an operational range (step S101), and when the work is positioned in the operational range, a following path is formed and the robot follows the work (step S102). The following path is repeatedly formed until completion of handling of the work (step S104), while a process loop (REPEAT . . . UNTIL) checks whether or not the work moves outside of the operational range (step S103). When the robot moves outside of the operational range, the following motion is suspended and an error process is performed (step S105).
In the known technology, since it is checked, based on a user program, whether or not the work arrives in the operational range (handling region) of the robot, laborious work such as program creation is required of the user, and the program becomes complex thus less readable.
When the program is suspended for any reason while the robot is performing the following motion, there is a risk of the robot colliding against other devices disposed in the operational range of the robot or an error is caused by the robot trying to operate beyond its operational range.
A robot controller which controls a plurality of devices such as a camera and a robot is provided with a multi-tasking ability to perform at a high speed a parallel processing of a plurality of programs such as a program concerning determination of the position of the work and an operational program of the robot. However, some processes such as checking for arrival and deviation of the work which may enough function even by a simple checking at given intervals are processed excessively due to the process loops, whereby the operational speed of the other programs is decreased and the performance of the robot controller as a whole is lowered, that is, the multi-tasking ability is not used efficiently.
The known handling system generally includes a straight conveyor, and it is difficult to control motion to follow the works conveyed on a conveyor which has a curved conveying pathway for the works, such as a turntable or an arc-shaped conveyor. A technology is disclosed in, for example, Japanese Unexamined Patent Application Publication No. 60-221805, which overcomes this drawback. However, the drawback of the large amount of computation required for determining the position of the work has not been solved.
Accordingly, it is an object of the present invention to provide a method for controlling a robot and a robot controller using the method in which the amount of computation for determining the present position of a work conveyed on a conveyor is decreased regardless of a moving path, a robot operation on a moving object can be described easily, and intuitive teaching is made possible.
It is another object of the present invention to provide a method for controlling a robot and a robot controller using the method in which a program can be described easily and the execution speed of the program can be increased by setting a handling region (following region) of the robot and by providing a function to check the relationship of the positions between the following region and the work.
(1) According to one aspect of the present invention, a method for controlling a robot, which follows a moving object conveyed by a conveyor and which performs a predetermined action on the moving object, is provided. The method comprises the steps of detecting the moving object; obtaining a detected position of the moving object in a conveyor coordinate system from the result of the detection; sequentially updating a current position of the moving object in the conveyor coordinate system on the basis of the detected position of the moving object and the amount of movement of the conveyor; transforming the current position of the moving object in the conveyor coordinate system to that in a robot coordinate system; and forming a following path for the robot to follow the moving object, on the basis of the transformed position.
(2) In the method for controlling a robot according to the present invention, the conveyor coordinate system may consist of an x-axis in the movement direction of the moving object, a y-axis which represents, together with the x-axis, a carrying surface of the conveyor, and a z-axis perpendicular to the x-axis and the y-axis.
(3) The method for controlling a robot according to the present invention may further comprise the step of making the robot start a following motion according to a motion command to follow the moving object at a position designated by designated-position data included in the motion command, provided that the designated position data are set in the conveyor coordinate system.
(4) The method for controlling a robot according to the present invention may further comprise the steps of setting a following region in the conveyor coordinate system; determining, on the basis of the following region and a current position of the moving object, whether or not the moving object is positioned in the following region; generating a moving-object-arrival event when determining that the moving object is positioned in the following region; and making the robot start a following motion according to a motion command to follow the moving object at a position designated by designated-position data included in the motion command, when the moving-object-arrival event is generated.
(5) In the method for controlling a robot, according to the present invention, it may be determined at a given frequency whether or not the moving object is positioned in the following region.
(6) In the method for controlling a robot, according to the present invention, the following region may be defined by two first lines parallel to the movement direction of the moving object and two second lines perpendicular to the first lines, on a carrying surface of the conveyor.
(7) In the method for controlling a robot, according to the present invention, the following path for the robot to follow the moving object may be formed by adding an additional path in the movement direction of the moving object to a direct path of a tool of the robot in a direction toward a starting position, where the moving object is positioned at the start of the following motion, wherein the additional path is obtained by transforming change of the position of the moving object in the conveyor coordinate system to that in the robot coordinate system and further to that in a robot joint-angle coordinate system, and the direct path is obtained by transforming positions of the tool of the robot and the moving object at the start of the following motion, respectively in the robot coordinate system and the conveyor coordinate system, to those in the joint-angle coordinate system.
(8) The method for controlling a robot according to the present invention may further comprise the steps of generating a following-motion-suspension event when it is determined that the moving object is not in the following region; and performing a process in response to the following-motion-suspension event.
(9) In the method for controlling a robot, according to the present invention, the process in response to the following-motion-suspension event may be a process to suspend the formation of the additional path.
(10) The method for controlling a robot according to the present invention may further comprise the steps of suspending the formation of the additional path according to a motion command including designated-position data, provided that the designated position data are set in the robot coordinate system; and forming the following path by the direct path in a direction toward a position designated by the designated position data.
(11) In the method for controlling a robot, according to the present invention, one conveyor coordinate system may be provided for each of a plurality of the conveyors.
(12) In the method for controlling a robot, according to the present invention, the conveyor coordinate system and the following region may be provided for each of a plurality of the robots.
(13) In the method for controlling a robot, according to the present invention, the conveyor may comprise a straight conveyor.
(14) In the method for controlling a robot, according to the present invention, the conveyor may comprise either an arc-shaped conveyor or a turntable, and the coordinate system of the conveyor may comprise an x-coordinate represented by a rotation angle, a z-coordinate represented by an axis of the rotation of the conveyor, and a y-coordinate represented by a distance from the axis of the rotation.
(15) According to another aspect of the present invention, a robot controller for controlling a robot which follows a moving object conveyed by a conveyor and which performs a predetermined action on the moving object comprises a moving-object-current-position-storing section for storing a current position of the moving object; a detector for detecting the moving object; a moving-object-current-position-updating section for obtaining the position of the moving object in a conveyor coordinate system from the result of the detection by the detector, computing a current position of the moving object on the basis of the detected position of the moving object and the amount of movement of the conveyor, and updating the moving-object-current-position-storing section with the computed data; and a path-forming section for transforming the current position of the moving object in the conveyor coordinate system stored in the moving-object-current-position-storing section to that in a robot coordinate system, and forming a following path for the robot to follow the moving object, on the basis of the transformed position.
(16) In the robot controller according to the present invention, the conveyor coordinate system may consist of an x-axis in the movement direction of the moving object, a y-axis which represents, together with the x-axis, a carrying surface of the conveyor, and a z-axis perpendicular to the x-axis and the y-axis.
(17) The robot controller according to the present invention may further comprise a user-program-executing section which executes a user program described with a motion command and which determines whether or not designated-position data included in the motion command are described in the conveyor coordinate system. The path-forming section may form a following path for the robot to follow the moving object at a position designated by the designated-position data included in the motion command, when the user-program-executing section determines that the designated-position data are described in the conveyor coordinate system.
(18) The robot controller according to the present invention may further comprise a following-region-storing section for storing a following region represented by coordinates in the conveyor coordinate system; and an event-detecting section which determines, on the basis of the current position of the moving object stored in the moving-object-current-position-storing section and the following-region stored in the following-region-storing section, whether or not the moving object is positioned in the following region, which generates a moving-object-arrival event when determining that the moving object is positioned in the following region, and which generates a following-motion-suspension event when determining that the moving object is not positioned in the following region. The path-forming section may form a following path for the robot to follow the moving object at a position designated by the designated-position data included in the motion command when the moving-object-arrival event is generated.
(19) In the robot controller according to the present invention, the event-detecting section may determine at given intervals whether or not the moving object is positioned in the following region.
(20) In the robot controller according to the present invention, the following region may be defined by two first lines parallel to the movement direction of the moving object and two second lines perpendicular to the first lines, on a carrying surface of the conveyor.
(21) In the robot controller according to the present invention, the path-forming section may form the following path for the robot to follow the moving object by adding an additional path in the movement direction of the moving object to a direct path of a tool of the robot in a direction toward a starting position, where the moving object is positioned at the start of the following motion, wherein the additional path is obtained by transforming change of the position of the moving object in the conveyor coordinate system to that in the robot coordinate system and further to that in a robot joint-angle coordinate system, and the direct path is obtained by transforming positions of the tool of the robot and the moving object at the start of the following motion, respectively set in the robot coordinate system and the conveyor coordinate system, to those in the robot joint-angle coordinate system.
(22) In the robot controller according to the present invention, the user-program-executing section may start performing a process in response to the following-motion-suspension event when the event-detecting section generates the following-motion-suspension event.
(23) In the robot controller according to the present invention, the process in response to the following-motion-suspension event may be a process to suspend the formation of the additional path.
(24) In the robot controller according to the present invention, the path-forming section may suspend the formation of the additional path and form the following path consisting of the direct path in a direction toward a position designated by the designated position data, when the user-program-executing section determines that the designated-position data included in the motion command are set in the robot coordinate system.
(25) In the robot controller according to the present invention, one conveyor coordinate system may be provided for each of a plurality of the conveyors.
(26) In the robot controller according to the present invention, the conveyor coordinate system and the following region may be provided for each of a plurality of the robots.
(27) In the robot controller according to the present invention, the conveyor may comprise a straight conveyor.
(28) In the robot controller according to the present invention, the conveyor may comprise either an arc-shaped conveyor or a turntable, and the coordinate system of the conveyor may comprise an x-coordinate represented by a rotation angle, a z-coordinate represented by an axis of the rotation of the conveyor, and a y-coordinate represented by a distance from the axis of the rotation.
With the arrangement described in the above (1) and (15), by updating the current position of the moving object in the conveyor coordinate system, the computation for the update becomes simple compared with the case of the update in the robot coordinate system. When describing a predetermined motion to the moving object, a simple and intuitive designation of the position is possible by using the conveyor coordinate system as a reference, and program description becomes easy.
With the arrangement described in the above (2) and (16), since the x-axis of the conveyor coordinate system is disposed in the direction of the movement of the moving object, only the x-coordinate value of the position of the moving object varies. Therefore, only the x-coordinate value must be updated for the update of the current position of the moving object, whereby the amount of computation can be reduced compared with the case of the update in the robot coordinate system.
With the arrangement described in the above (3) and (17), the following motion of the robot can be started only by a motion command including designated-position data of the conveyor coordinate system, without a following-motion-start command. Therefore, program description by the user without considering the movement of the conveyor is made possible.
With the arrangement described in the above (4), (5), (6), (18), (19), and (20), a following region is set in the conveyor coordinate system, and it is determined, on the basis of the following-region and the current position of the moving object, whether or not the moving object is positioned in the following region. When it is determined that the moving object is positioned in the following region, a moving-object-arrival event is generated, and when the moving-object-arrival event is generated, a process for the robot to follow the moving object at a position designated by the designated-position data included in the motion command. Therefore, it is not necessary to describe a process loop in a user program while monitoring the position of the moving object, whereby the program can be readable and the process speed can be increased.
With the arrangement described in the above (7) and (21), the additional path in the movement direction of the moving object is formed on the basis of the change of the current position of the moving object and, whereby the following path can be formed such that the variations in the speed of the conveyor are compensated for.
With the arrangement described in the above (8) and (22), when it is determined that the moving object is not positioned in the following region, a following-motion-suspension event is generated and a process corresponding to the following-motion-suspension event starts. Therefore, an operation program for avoiding a risk of an error being produced in that, for example, the robot keeps the following motion beyond its operational range. That is, the user must only described a motion for avoiding the above risk as a process corresponding to the following-motion-suspension event.
With the arrangement described in the above (9) and (23), when the following-motion-suspension event is generated, the formation of the additional path is suspended. Therefore, a risk in that the robot continues the following motion beyond the following region can be automatically and reliably avoided.
With the arrangement described in the above (10) and (24), in execution of a motion command including designated-position data set in the robot coordinate system, the formation of the additional path is suspended and the direct path toward the designated position is formed. Therefore, when the targeted position (designated position) is disposed outside the conveyor, the formation of the additional path can be automatically suspended and the robot can be automatically moved to the designated position, by the user describing the designated position data in the robot coordinate system, whereby the user can create a program without considering the current state of the robot or the movement of the conveyor.
With the arrangement described in the above (11) and (25), when a plurality of the conveyors are used, a conveyor coordinate system is provided for each of the plurality of conveyors, whereby a program for conveying the moving object from one of the conveyors to another conveyor can be easily created by describing a motion command including designated-position data set in the corresponding coordinate system.
With the arrangement described in the above (12) and (26), a plurality of the robots can be used for one conveyor by providing the conveyor coordinate system and the following region for each robot.
With the arrangement described in the above (13), (14), (27), and (28), the advantages described above can be offered by using either a straight conveyor, an arc-shaped conveyor, or a turntable as the conveyor.